import Vue from "vue"
import * as filters from "../assets/js/filters.js"
import { color,permission,permissionstore } from "../assets/js/directives.js"
import wxjButton from "../components/common/wxjButton"

let show = () => console.log("show")

// 原型绑定 属性或方法
Vue.prototype.$show = show

// 定义全局过滤器
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key])
})

// 注册全局指令
Vue.directive("permissionstore", permissionstore)
Vue.directive("permission", permission)
Vue.directive("color", color)



// 注册全局组件
Vue.component("wxjButton", wxjButton)


// 混入一个function 专门用来处理每页的 headers信息
Vue.mixin({
    methods: {
        $seo(title, content, payload=[]) {
            return {
                title,
                meta: [
                    {
                        hid: 'descrition',
                        name: "keywords",
                        content
                    },
                    ...payload
                ]
            }
        }
    }
})